<template>
	<!-- 车辆添加 -->
	<div>
		<div class="edit-top">
			<template v-if="status == 1">
				审核信息
			</template>
			<template v-else>
				审批信息
			</template>
			<i class="el-icon-close" @click='cancel'></i>
		</div>
		<div class="edit-content" style="height: 200px;">
			<div class="edit-item" style="clear: both;">
				<label style="float: left;">评价内容</label><textarea v-model="remark" rows="10" />
				</div>
		</div>
		<div class="edit-bottom">
			<span @click='cancel'>驳回</span>
			<el-button @click='save' v-if="status == 1" type="primary">审核通过</el-button>
			<el-button @click='save' v-if="status == 3" type="primary">审批通过</el-button>
		</div>
	</div>
</template>

<script>
	let _this;
	export default {
		props: ['id','status'],
		data() {
			return {
				remark:''
			}
		},
		created() {
			_this = this;
		},
		methods: {
			save() {
				var s = {};
				s.id = this.id;
				s.note = this.remark;
				if(this.status == 1){
					s.status = 3
				}else{
					s.status = 4
				}

				this.$axios.post(this.$global.serverIp + 'vehicle/vehicle/approve', s)
					.then(function(res) {
						if (res != '') {
							_this.success('提交成功');
						}
					})

			},
			success(content) {
				this.$alert(content, '提示', {
					confirmButtonText: '确定',
					callback: action => {
						_this.$emit("saveApproval", 2);
					}
				});
			},
			cancel() {
				var s = {};
				s.id = this.id;
				s.note = this.remark;
				s.status = 0;
				this.$axios.post(this.$global.serverIp + 'vehicle/vehicle/approve', s)
					.then(function(res) {
						if (res != '') {
							_this.success('提交成功');
						}
					})
			}
		}
	}
	import '@/assets/css/edit.css'
</script>
